package com.yoke.service.rewrite;

import com.yoke.system.SystemBean;
import com.yoke.system.log.SystemLog;
import com.yoke.util.CmdUtil;

import java.io.IOException;

/**
 * Created by Administrator on 2017/5/11.
 */
public abstract class RewriteBaseService {

    public String getConfPath() {
        return SystemBean.getInstance().getEnvironment().getProperty("nginx.conf");
    }

    public void reload(String reuse) {
        try {
            String info = CmdUtil.cmdExec("nginx -s reload");
            SystemLog.LOG("nginx").info("因为：" + reuse + " 重启nginx：" + info);
        } catch (IOException e) {
            SystemLog.ERROR().error("保存跳转", e);
            SystemLog.LOG("nginx").info("因为：" + reuse + " 重启nginx 失败：" + e.getLocalizedMessage());
        }
    }
}
